<template>
  <div id="AsnDetail">
    <div class="detail">
      <component :inputData="detailData"
                 :is="currentComponent"
                 ref="comRef"></component>
    </div>
  </div>

</template>

<script>
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "AsnDetail",
  mixins: [baseMixin],
  data () {
    return {
      newFlag: false,
      selectData: {},
      detailData: {
        enterprisecode: "0",
        usedexternallyindicator: "0",
        editable: "1",
        subdetail: "0",
        sourceversion: 0
      },
      detailNav: "1",
      componentConfig: [
        {
          name: "ZoneDetails",
          label: this.$t('bill.detail'),
          component: () => import('./page/particulars.vue')
        }
      ],
    }
  },
  computed: {
    currentComponent () {
      return this.componentConfig[this.detailNav - 1].component;
    }
  },
  methods: {
    async getData () {
      try {
        let res = await this.$api.get(`queryCodelistByListname/${this.$store.state.wms}/${this.selectData.listname}`);
        
          this.detailData = res.bean;
        
      } catch (e) {
        this.$message.error(e);
      }
    },
    initshowNewBtn () {
      this.$parent.showNewBtn = this.$refs.comRef.showNewBtn
    }
  },
  mounted () {
    this.newFlag = this.$store.state.newFlag;
    if (Object.keys(this.$store.state.skip).length !== 0) {
      let data = this.$store.state.skip;
      this.detailData = data.detail;
      this.selectData = data.routeData;
      this.detailNav = data.detailNav;
      this.$store.commit("setNewFlag", data.newFlag)
    } else if (!this.newFlag) {
      this.selectData = this.$store.state.routeData;
      this.getData();
    }
  },
  components: {},

}
</script>

<style scoped>
</style>
